package com.xgst.runningmanager.fragment

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.blankj.utilcode.util.ActivityUtils
import com.xgst.runningmanager.InputErrorActivity
import com.xgst.runningmanager.InputWorkOrderActivity
import com.xgst.runningmanager.databinding.FragmentXuntingBinding
import io.rong.callkit.RongCallKit
import io.rong.imkit.conversationlist.RongConversationListActivity
import io.rong.imlib.model.Conversation

class LookFragment:Fragment() {
    private lateinit var binding:FragmentXuntingBinding
    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        binding = FragmentXuntingBinding.inflate(inflater,container, false)
        init()
        return binding.root
    }

    private fun init() {
        binding.btnX.setOnClickListener {
            //巡检工单录入
            ActivityUtils.startActivity(InputWorkOrderActivity::class.java)
        }
        binding.btnS.setOnClickListener {
            //失范行为上传
            ActivityUtils.startActivity(InputErrorActivity::class.java)
        }
        binding.btnB.setOnClickListener {
            //一键报警  一对一通话
            RongCallKit.startSingleCall(activity, "xgst222", RongCallKit.CallMediaType.CALL_MEDIA_TYPE_VIDEO);
        }
        binding.btnXunTing.setOnClickListener {
            //巡厅连线  多视频通话
            val targetId = "group111"
            val mediaType = RongCallKit.CallMediaType.CALL_MEDIA_TYPE_VIDEO
            val userIds = ArrayList<String>()
            userIds.add("xgst222")
            userIds.add("xgst333")
            RongCallKit.startMultiCall(
                activity,
                Conversation.ConversationType.GROUP,
                targetId,
                mediaType,
                userIds
            )
        }

        binding.btnIM.setOnClickListener {
            ActivityUtils.startActivity(RongConversationListActivity::class.java)
        }
    }
}